package com.baiwei.vpnapi.entity.reqentity;

import com.baiwei.vpnapi.exception.AccountException;
import com.baiwei.vpnapi.exception.BusinessEnum;

/**
 * @program: vpnapi
 * @description: 登录输入
 * @author: Mr. Stone
 * @create: 2020-02-27 05:04
 **/
public class LoginInput implements Validatable {
    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public LoginInput(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public LoginInput(){}

    @Override
    public void validation() {
        if(username == null && username.length() == 0) {
            throw new AccountException(BusinessEnum.USERNAME_LOGIN_EMPTY);
        }
        if(password == null && password.length() == 0) {
            throw new AccountException(BusinessEnum.PASSWORD_LOGIN_EMPTY);
        }
    }
}
